package org.prothlisberger.musicsearch.db;

import static org.junit.Assert.assertEquals;

import java.io.File;
import java.util.Collections;
import java.util.List;

import org.junit.Test;

public class TestMusicDatabase {

	@Test
	public void testAbc() {
		MusicDatabaseFactory vFactory = new MusicDatabaseFactory();
		vFactory.setRootDir(new File(
				"src/org/prothlisberger/musicsearch/db/test"));
		MusicDatabase vDB = vFactory.createDatabase();

		assertEquals("Count", 4, vDB.getCount());

		List<File> vSearchResult;

		vSearchResult = vDB.search(".*file1.*");
		assertEquals("nb file1.TXT", 2, vSearchResult.size());

		vSearchResult = vDB.search(".*FILE1.*");
		System.out.println(vSearchResult);
		assertEquals("nb FILE1.TXT", 2, vSearchResult.size());

		vSearchResult = vDB.search(".*0101,*");

		assertEquals("nb 0101", 0, vSearchResult.size());
		Collections.sort(vSearchResult);

	}

}
